This invention relates to management of non-hierarchical locks that serialize the access of multiple systems to shared data resources.
In U.S. Pat. No. 4,965,719 of Shoens et al, a hierarchical locking scheme is disclosed which serializes the access of a plurality of parallel systems to shared data resources. A lock hierarchy is proposed that requires a transaction to acquire a lock on a data resource's parent before acquiring a lock on the data resource itself. The hierarchical structure requires, for example, that a lock be acquired on a page of data before a lock may be acquired on a record in the page.
Transactions acquire access to data resources through a database management system (DBMS). The DBMS of the Shoens patent includes a transaction manager, a buffer manager, and a resource lock manager. In the Shoens patent, before a transaction-level record lock can be acquired, an inter-system page lock must be acquired by the buffer manager of a DBMS. In this multiple-DBMS system, an interest manager mediates competing requests from buffer managers for a page in order to guarantee coherency of any page buffered from a shared direct access storage device (DASD).
In the prior art system, the first transaction-level request for a record or a page necessitates suspension of the transaction until the local buffer manager has requested and been granted a lock on the page by the interest manager. This is shown more clearly in FIG. 1.
In FIG. 1, when the first transaction request 10 for a data resource (such as a page) is received by a DBMS, a request for the page to the buffer manager reveals that the page is not in the buffer pool and requires the buffer manager to request and acquire a lock 12 on the page from the interest manager. In the meantime, the transaction is suspended until the buffer manager receives the lock and reads the page into the buffer pool. Then the first, and any subsequent transaction requests for locks on the page and for objects on the page are processed 14. When the locks are received, the transactions process the components (records, for instance) of the page at 16. When transaction processing concludes, the transaction locks are released at 18 and the buffer lock at 20. Thus, the lock hierarchy of the prior art multi-system environment requires that step 12 precede step 14 in all cases where the data resource must be buffered for transaction processing.
Prior art methods for inter-system locking in multi-DBMS environments recognize locking modes. In the Shoens et al. patent, the modes are referred to as "Update" and "Share". More recent database management systems recognize lock modalities with more than two possible values. For example, in the DB2 system available from the Assignee, the possible modes of a lock are:
X (Exclusive) PA1 U PA1 S ( Shared ) PA1 N (Null:implies that the lock is not held) PA1 (a) responsive to receipt of a first request for a lock of either type by a local lock manager for a data resource, the local lock manager transmits to the global lock manager a request for a lock (LP lock) that indicates DBMS interest in the data resource; and PA1 (b) upon receipt of a grant of the requested LP lock by the global lock manager, the local lock manager grants the first request. PA1 (c) in response to receipt of a subsequent request for a lock of any type on the data resource, the local lock manager generates a resultant mode of all locks granted for the data resource, the resultant mode corresponding to the highest magnitude mode of any lock granted on the data resource; PA1 (d)(1) if the subsequent request is for a lock with a mode having magnitude greater than the resultant mode, the local lock manager transmits to the global lock manager a request for the LP lock in the requested mode; and PA1 (d)(2) upon receipt of a grant of the LP lock in the requested mode, the local lock manager grants the requested lock; otherwise PA1 (e) the local lock manager grants the subsequent request without communication with the global lock manager. The principal objective of the invention is to reduce the message traffic between a local lock manager and a global lock manager necessary for acquiring and releasing data resource locks in an environment where a plurality of database management systems access common data storage resources.
The structuring of lock modes implies a magnitude differentiation, in which X&gt;U&gt;S&gt;Null. In the data resource context, an X lock is more restrictive for access to the resource than U-mode and U-mode is more restrictive than mode S. Further, compatability between the U- and S-modes is observed wherein a transaction seeking an S-mode lock on a data resource will not be denied access to the resource if another transaction holds a U-mode lock on the same resource. However, the X-mode is incompatable with all modes (including the X-mode), and any requests for a lock of any magnitude on a data resource for which an X-mode lock is held will be denied.